<!-- <button nz-button nzType="primary">同步</button>  -->
<button nz-button nzType="primary" (click)="new()">新增</button>
<button nz-button nzType="primary" nzDanger (click)="onDelete()">删除</button>
<button nz-button nzType="primary" (click)="showSetPermissionModal()">
  设置权限
</button>
<nz-table
  #headerTable
  [nzData]="listOfCurrentPageData"
  [nzPageSize]="pageable.size"
  nzFrontPagination="false"
  [nzScroll]="{ y: 'calc(100vh - 330px)' }"
  [nzPageIndex]="pageable.page"
  nzServerRender="true"
  [nzTotal]="total"
  (nzCurrentPageDataChange)="onCurrentPageDataChange($event)"
  (nzPageSizeChange)="onPageSizeChange($event)"
  (nzPageIndexChange)="onPageIndexChange($event)"
  nzShowPagination
  nzShowSizeChanger
>
  <thead>
    <tr>
      <th
        nzWidth="60px"
        [nzChecked]="checked"
        [nzIndeterminate]="indeterminate"
        (nzCheckedChange)="onAllChecked($event)"
      ></th>
      <th>类名</th>
      <th nzWidth="100px">名称</th>
      <th>备注</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of headerTable.data">
      <td
        [nzChecked]="setOfCheckedId.has(data.name)"
        (nzCheckedChange)="onItemChecked(data.name, $event)"
      ></td>
      <td>{{ data.id }}</td>
      <td>{{ data.name }}</td>
      <td>{{ data.remark }}</td>
    </tr>
  </tbody>
</nz-table>

<nz-modal
  [nzFooter]="null"
  [(nzVisible)]="isNewVisible"
  nzTitle="新增"
  (nzOnCancel)="handleCancel()"
>
  <nz-content *nzModalContent>
    <form
      nz-form
      nzLayout="vertical"
      [formGroup]="validateForm"
      (ngSubmit)="submitForm()"
    >
      <nz-form-item>
        <nz-form-label>类名</nz-form-label>
        <nz-form-control nzErrorTip="">
          <input nz-input formControlName="name" placeholder="请输入类名" />
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label>名称</nz-form-label>
        <nz-form-control nzErrorTip="">
          <input nz-input formControlName="nameTxt" placeholder="请输入名称" />
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label>所属应用</nz-form-label>
        <nz-form-control nzErrorTip="">
          <app-app-search></app-app-search>
        </nz-form-control>
      </nz-form-item>

      <nz-form-item>
        <nz-form-label>备注</nz-form-label>
        <nz-form-control nzErrorTip="">
          <textarea
            rows="3"
            nz-input
            formControlName="remark"
            placeholder="请输入备注"
          >
          </textarea>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-control>
          <button nz-button nzType="primary">保存</button>
          <button nz-button nzType="primary" (click)="handleCancel()">
            取消
          </button>
        </nz-form-control>
      </nz-form-item>
    </form>
  </nz-content>
</nz-modal>

<nz-modal
  [(nzVisible)]="isVisibleForSetPermission"
  nzTitle="设置模型权限"
  (nzOnCancel)="handleCancel()"
  (nzOnOk)="saveModelPermission()"
>
  <nz-content *nzModalContent>
    <app-set-model-permission></app-set-model-permission>
  </nz-content>
</nz-modal>
